II Something
by Clark Hugh Stiles
January 16, 2002 

Building a link isn't hard. There are three basic kinds, of which I'll give two right here, then move on to FRAMEs. 
[see listing 1 in next message] 
This is a link to Google, as shown before, but with a couple of additions. TARGET is a handy parameter to have, and is a must when using FRAMEs. This "_blank" target instructs compatible browsers to load the link in a new window, leaving the old one intact behind it. In single window browsers and some older versions of the big name browsers, it will be ignored and the link will be loaded into the current window. 

The ON MOUSE OVER parameter (all one word -- had to list it this way because of the cuss filter on Delphi) probably requires JavaScript to be turned on (JavaScript isn't Java, and there's a separate preference option for it in the browsers). All this one does is change the status line in Netscape to show the desired text, in this case, "opens in new window", instead of showing the link URL. It's a nice touch. In MSIE the text shows up as a balloon after a second or so of hovering over the link. 
[see listing 2 in next message] 
That's the second type of link. It uses an image (in this hypothetical example, "icon.gif") instead of text to offer the link. Those without image display will see the text "Google" instead because of the ALT tag. Also, MSIE users will get a balloon popup after a second or so of hovering over the image link containing the ALT text, whether or not we use the ON MOUSE OVER stuff. 

The third kind of link also uses JavaScript to make a popup menu page selector. It requires JavaScript and FORM support, and when the link is selected the jump happens. If you have a browser which supports this, you'll see an example of this in some Delphi forums, near the top of the window. I first noticed it on some webpage, probably on GeoCities, but the cleanest code example can be found on Paul McFedries' website. PM is the author of a couple of the Idiot's Guide books and both his site and his books are worth checking out. 
Paul McFedries website 
In order to control the width of the post here, I'm going to use the basic links seen in the earlier installments in the rest of the listings. 

Frames are often screwed up by the webmasters. In my opinion, the easiest to use for website visitors are those with a single menu listing across the bottom of the page, with the menu clicks directed to the large upper window. This works best for sites with just a few pages, or online documents where only the page number needs to be displayed in the link. 

The most common frames layout is the one you see here on Delphi, provided of course you've got a compatible browser. Since it's sometimes difficult to see what's going on, or to list source of pages you can't load, this tiny little tutorial may be of some use to you. I wrote HTML using FreeWriter, HTE, and occasionally EgoEd, as well as generating it using AppleSoft, for a couple of years before I had regular access to a graphical interface. 

Here's the basic, barebones contents of a typical framework. 
[see listing 3 in next message] 
Okay, let's take this line by line. The first six lines should be familiar from the earlier examples, as should the last line. Those are most of the barebones requirements for an HTML page. Actually, the barebones minimum is probably less than that, consisting of the open and close HTML tags, open and close BODY tags, and whatever content goes between open and close. 

The seventh line, FRAMESET, is where the magic more or less begins. This sets up two frames, the first consisting of the 50 rows of pixels, the second consisting of whatever's left. This is the most compatible with the machines and browsers out there. It is also possible to set it up by columns first, but let's not do that for now. 

The FRAMEBORDER and FRAMESPACING are set to zero, as is the border. This minimizes the gaps between the frames. That's a design choice, but I think it makes frames more attractive to the eye. Also, with lots of lines running all over the interface tends to look gadgety. 

Line eight uses FRAME SRC to load our second file, "upper.html", into the 50 pixel row high upper frame.Assigning a name is mandatory. The TARGET parameter will be used in our menu links to direct the various pages into the proper frames. This project will construct a three box setup, with the site name across the top, and two columns below. The left column ("ListWin") will be narrow and contain links to various pages within the site, and the right column ("MsgWin") will be wide and receive the loaded pages. Links will be set up for TARGET="MsgWin" for the most part, in a special timesaving way I'll show you next time. 

I selected these names ("UpperFrame", "LowerFrame", "ListWin", and "MsgWin") for compatibility with the Delphi frame names, but you should feel free to use your own, as long as you feel you know what you're doing. 

SCROLLING and RESIZE are set to no, and the name of the frame is given. Scrolling and resizing are necessities for some windows, but as this window will contain our logo, I see no point to that. I'm not sure, since I've not tried, but it may be possible to specify an image (JPG or GIF file) as the FRAME SRC. Experiment if you want. 

Line nine uses FRAME SRC to load our second file, "lower.html", into the remaining portion of the screen, which is probably larger than the upper frame. As with the upper frame, MARGINHEIGHT is set to zero to minimize the gap between frames, but unlike the upper frame, scrolling is not shut down. 

Next comes NOFRAMES, which is important for users of Lynx and other browsers which don't support frames. Nothing was more offensive to me than going to a frames based site and getting the message, "your browser doesn't support frames." That's given in practically every programming example I've seen for frames, and it's just stone cold stupid. Between NOFRAMES and the /NOFRAMES tags, paste in your site menu. It'll be the same text as you're about to write for the menu frame, so maintaining it is trivial. If you wanted to be a total smart ass, you could put in NOFRAMES-only links and features. Heh heh. 

Notice that the BODY and its close tag are within the NOFRAMES tags? That's what makes it work. Everything in there works as if there were no frames code at all on the page, provided the user has a browser that doesn't support frames, or one with frames support somehow disabled. 

Okay, here's some other details of this BODY text. Notice that there's an image specified for the background? That's the same one you'll use (probably) for the rest of the site. Having frames means you should take more care to make the interface unifor ...[Message truncated] 
